#!/usr/bin/python
# vi: et sw=2
#
# Test PulseObj
#
# Author: Harry Karvonen <harry.karvonen@gmail.com>
#

from GnomePulseAppletInterface import PulseObj2,PulseSinkInputInfo,PulseVolume

clients = dict()
sinks = list()

def action_complete():
  print "Action complete"

def append_sink(sink):
  print "Append sink"
  
  if isinstance(sink, PulseSinkInputInfo) and \
     sink.client_id in clients.keys():
    sink.client = clients[sink.client_id]

  sinks.append(sink)

def append_client(client):
  print "Append client"
  clients[client.index] = client

pulse = PulseObj2()

pulse.cb_action_complete = action_complete
pulse.cb_sink_append = append_sink
pulse.cb_sink_input_append = append_sink
pulse.cb_client_append = append_client

pulse.pulse_client_list()
pulse.pulse_sink_list()
pulse.pulse_sink_input_list()

for a in sinks:
  print a

pulse.pulse_disconnect()

